import i18n from "@/lang/index";
import GamesAPI from "@/api/games";
const searchConfig = {
  pageName: "sys:user1",
  formItems: [
    {
      type: "input",
      label: i18n.global.t("label.16"),
      prop: "ulid",
      attrs: {
        placeholder: i18n.global.t("label.16"),
        clearable: true,
        style: {
          width: "200px",
        },
      },
    },
    {
      type: "input",
      label: i18n.global.t("label.15"),
      prop: "user_id",
      attrs: {
        placeholder: i18n.global.t("label.15"),
        clearable: true,
        style: {
          width: "200px",
        },
      },
    },
    {
      type: "input",
      label: i18n.global.t("label.9"),
      prop: "username",
      attrs: {
        placeholder: i18n.global.t("label.9"),
        clearable: true,
        style: {
          width: "200px",
        },
      },
    },
    {
      type: "select",
      label: i18n.global.t("label.33"),
      prop: "game_id",
      attrs: {
        filterable: true,
        placeholder: i18n.global.t("label.33"),
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options:[],
      initFn(){
        let params = {
          page: 1,
          per_page: 1000,
        }
        GamesAPI.getList(params).then((res) => {
          this.options = res.data.map((item) => {
            return {
              label: item.name,
              value: item.id,
            }
          })
        });
      }
    },
    {
      type: "select",
      label: i18n.global.t('search.15'),
      prop: "status",
      attrs: {
        placeholder: i18n.global.t('status.3'),
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options: [
        { label: i18n.global.t('status.38'), value: 'refunded' },
        { label: i18n.global.t('status.29'), value: 'pending' },
        { label: i18n.global.t('status.30'), value: 'canceled' },
        { label: i18n.global.t('status.37'), value: 'settled' },
      ],
    },
    {
      type: "select",
      label: i18n.global.t('search.28'),
      prop: "result_type",
      attrs: {
        placeholder: i18n.global.t('status.3'),
        clearable: true,
        style: {
          width: "200px",
        },
      },
      options: [
        { label: i18n.global.t('status.35'), value: 'won' },
        { label: i18n.global.t('status.34'), value: 'lost' },
        { label: i18n.global.t('status.33'), value: 'draw' },
      ],
    },
    {
      type: "date-picker",
      label: i18n.global.t("label.46"),
      prop: "created_at",
      allowCrossMonth: false,
      attrs: {
        type: "datetimerange",
        "range-separator": "~",
        "start-placeholder": i18n.global.t("search.6"),
        "end-placeholder": i18n.global.t("search.7"),
        "value-format": "YYYY-MM-DD HH:mm:ss",
        style: {
          width: "360px",
        },
      },
    },     
  ],
};

export default searchConfig;
